package com.raymond.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.raymond.entity.commons.BaseEnum;

import java.io.IOException;

/**
 * desc-整型枚举序列化
 *
 * @author houmenghe
 * @date 2025/04/21 20:38
 **/
public class CustomerIntegerEnumSerializer<E extends Enum<?> & BaseEnum> extends JsonSerializer<E> {

    @Override
    public void serialize(E value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
        jsonGenerator.writeNumber(value.getValue());
    }

}
